Skip to content

Adsk Contrib - Add support for ARM Neon intrinsics and Universal builds#1775

Closed
cedrik-fuoco-adsk wants to merge 84 commits into
AcademySoftwareFoundation:mainfrom
autodesk-forks:adsk_contrib/add-support-for-neon-intrinsic
Closed

Adsk Contrib - Add support for ARM Neon intrinsics and Universal builds#1775
cedrik-fuoco-adsk wants to merge 84 commits into
AcademySoftwareFoundation:mainfrom
autodesk-forks:adsk_contrib/add-support-for-neon-intrinsic

Conversation

@cedrik-fuoco-adsk
Copy link
Copy Markdown
Contributor

This PR is about Add support for ARM Neon intrinsics #1753.

  • Integrating sse2neon library to support ARM Neon intrinsic.
  • Adding a new option to enable SIMD (DOCIO_USE_SIMD). OCIO_USE_SSE still works for now.
  • Fixing issues that were preventing a universal build on MacOS.
  • Universal build is now the default on MacOS.

Note that at least another commit will be needed once Adsk contrib - Add support for minimum and recommended versions for dependencies is merged into the main branch.

Some performance results with a MacBook M1 (using a custom heavy_transform.clf):
image

cedrik-fuoco-adsk and others added 17 commits February 1, 2023 09:34
Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>
…s to fix issues with NaN handling.

Fixing issues in the unit tests for some tests. For some tests, the neon implementation is matching the C++ implementation instead of the SSE2 implementation.

Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>
Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>
Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>
Now check for OCIO_USE_SSE and HAVE_NEON before integrating sse2neon to the build.

Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>
…d on Apple and might interfere with optimization if not careful.

Updated CheckSupportSSE2.cmake and adding some checks in SSE.h to support universal build.
Added comments and new define (USING_INTEL_SSE, USING_ARM_NEON and USING_CPP) in LogOpCPU_tests which should help with understand what is going on.
Checking for SSE2 and ARM Neon only when OCIO_USE_SSE is ON.

Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>
Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>
Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>
…SE_SSE (they are sync up). Will replace OCIO_USE_SSE eventually.

Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>
Reverted defined changes in LogOpCPU_tests
Updated ocio.bat with OCIO_USE_SIMD
Minors comments changes

Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>
Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>
Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>
Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>
documentation tweak

Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>
Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>
Signed-off-by: Cédrik Fuoco <105517825+cedrik-fuoco-adsk@users.noreply.github.com>
Removing Findsse2neon as it is not needed

Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>
@doug-walker doug-walker changed the title Adsk Contrib - Add support for neon intrinsic Adsk Contrib - Add support for ARM Neon intrinsics and Universal builds Mar 17, 2023
Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>
…s to fix issues with NaN handling.

Fixing issues in the unit tests for some tests. For some tests, the neon implementation is matching the C++ implementation instead of the SSE2 implementation.

Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>
Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>
Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>
Now check for OCIO_USE_SSE and HAVE_NEON before integrating sse2neon to the build.

Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>
…d on Apple and might interfere with optimization if not careful.

Updated CheckSupportSSE2.cmake and adding some checks in SSE.h to support universal build.
Added comments and new define (USING_INTEL_SSE, USING_ARM_NEON and USING_CPP) in LogOpCPU_tests which should help with understand what is going on.
Checking for SSE2 and ARM Neon only when OCIO_USE_SSE is ON.

Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>
Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>
Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>
…SE_SSE (they are sync up). Will replace OCIO_USE_SSE eventually.

Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>
Reverted defined changes in LogOpCPU_tests
Updated ocio.bat with OCIO_USE_SIMD
Minors comments changes

Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>
Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>
Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>
Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>
documentation tweak

Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>
Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>
Removing Findsse2neon as it is not needed

Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>
Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>
Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>
…d on Apple and might interfere with optimization if not careful.

Updated CheckSupportSSE2.cmake and adding some checks in SSE.h to support universal build.
Added comments and new define (USING_INTEL_SSE, USING_ARM_NEON and USING_CPP) in LogOpCPU_tests which should help with understand what is going on.
Checking for SSE2 and ARM Neon only when OCIO_USE_SSE is ON.

Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>
Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>
…SE_SSE (they are sync up). Will replace OCIO_USE_SSE eventually.

Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>
Reverted defined changes in LogOpCPU_tests
Updated ocio.bat with OCIO_USE_SIMD
Minors comments changes

Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>
Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>
Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>
Removing Findsse2neon as it is not needed

Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>
Removing ocio_check_dependency_version.cmake as it is not needed anymore.
Changed how we detect if the installed OpenEXR and OpenImageIO are compatible with OCIO. It should be more robust now.

Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>
…/github.com/autodesk-forks/OpenColorIO into adsk_contrib/add-support-for-neon-intrinsic

Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>
set(is_OpenEXR_VERSION_valid FALSE)
# Check for compatibility between OpenEXR and OpenImageIO.
# Will set is_OpenEXR_VERSION_valid to TRUE if valid.
include(CheckForOpenEXRCompatibility)
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed how we check the version of the OpenEXR used by OpenImageIO. This should be more robust and won't create any unwanted target or variables.

@@ -1,38 +0,0 @@
# SPDX-License-Identifier: BSD-3-Clause
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed in favour of CheckForOpenEXRCompatibility.cmake

@cedrik-fuoco-adsk
Copy link
Copy Markdown
Contributor Author

cedrik-fuoco-adsk commented Mar 24, 2023

The branch is now rebased and conflicts have been resolved.
The PR is ready to be reviewed. Could you take a look? Thanks in advance! @remia @doug-walker

Copy link
Copy Markdown
Collaborator

@remia remia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me @cedrik-fuoco-adsk, thank you for adding more comments to the SSE header. Have to say Rosetta is surprisingly good at handling the SSE x86_64 binary. I guess if we want to further optimise we would have to start more in depth profiling but the improvements we get seem already quite large as is.

Comment thread share/cmake/utils/CompilerFlags.cmake Outdated
Comment thread src/OpenColorIO/SSE.h Outdated
Comment thread src/OpenColorIO/SSE.h Outdated
…rge issue)

Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>
Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>
@ConnorBaker
Copy link
Copy Markdown

Hi all,

I'd love to see these changes merged -- any remaining blockers?

Thank you for your work on this, @cedrik-fuoco-adsk!

michdolan
michdolan previously approved these changes Aug 28, 2023
@michdolan michdolan dismissed their stale review August 29, 2023 00:10

This PR was replaced with #1828

@michdolan
Copy link
Copy Markdown
Collaborator

Closing since #1828 replaces this PR

@michdolan michdolan closed this Aug 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants